<template>
<!-- vue3组件中的模板结构可以没有根标签div -->
  <h1>一个人的信息</h1>
  <h2>姓名：{{name}}</h2>
  <h2>年龄：{{age}}</h2>
  <h2>薪资：{{job.j1.title}}K</h2>
  <button @click="person.name+='~'">修改i姓名</button>
  <button @click="person.age++">点我加1</button>
  <button @click="person.job.j1.title++">涨薪</button>

</template>

<script>
import {reactive, toRefs} from 'vue'

export default {
  name: 'App',
  setup() {
    // Data
      let person = reactive({
        age:18,
        name:"管",
        job:{
          j1:{
          title: 20
          }
        }
      }) 
      const x = toRefs(person)
      console.log(x);

      return {
        person,
        ...toRefs(person),
      }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
